package main

/**
 * return the min number
 * @param arr int整型一维数组 the array
 * @return int整型
 */
func minNumberdisappered_2(arr []int) int {
	n := len(arr)
	for i := 0; i < n; i++ {
		if arr[i] <= 0 {
			arr[i] = n + 1
		}
	}
	for i := 0; i < n; i++ {
		num := abs(arr[i])
		if num <= n {
			arr[num-1] = -abs(arr[num-1])
		}
	}
	for i := 0; i < n; i++ {
		if arr[i] > 0 {
			return i + 1
		}
	}
	return n + 1
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
